<?php
	if(!defined("IN_APP"))
	{
		exit;
	}

	$parm = requestArrayParm($_REQUEST);

	$method = getParam('m','get','menu');


	if($method == 'fanli_info')
	{
		unset($wheres);
		$wheres['uid'] = $loginuser['id'];
		$wheres['id'] = $parm['id'];

		$info = _Fanli::getFanliInfo($wheres);

		if($info)
		{
			//获取产品信息
			$info['chanpin'] = _ChanPin::getChanPinInfo(array('id'=>$info['pid']));
			//获取获取项目信息
			$info['item'] = _ChanPin::getChanPin_ItemInfo(array('id'=>$info['iid']));

			include renderTemplate('index/my/fanli_info');
		}
		else
		{

		}
	}

	if($method == 'info')
	{
		unset($wheres);
		$wheres['id'] = $loginuser['id'];
		$info = _User::getUserInfo($wheres);

		include renderTemplate('index/my/info');
	}

	if($method == 'menu')
	{
		if(!empty($loginuser))
		{
			$number = _Account_number::getAccount_numberList(array('uid'=>$loginuser['id']));
		}

		include renderTemplate('index/my');
	}


	if($method == 'apply_tixian')
	{
		unset($wheres);
		$wheres['id'] = $loginuser['id'];
		$info = _User::getUserInfo($wheres);

		if(!empty($loginuser))
		{
			$number = _Account_number::getAccount_numberList(array('uid'=>$loginuser['id']));


			if(empty($number))
			{
				header("Location:".SITE_URL.'index.php?a=my');
				exit;
			}

			include renderTemplate('index/my/apply_tixian');
		}


	}

	if($method == 'account_number')
	{
		unset($wheres);
		$wheres['uid'] = $loginuser['id'];
		$wheres['type'] = '1';
		$zhifubao = _Account_number::getAccount_numberInfo($wheres);

		unset($wheres);
		$wheres['uid'] = $loginuser['id'];
		$wheres['type'] = '2';
		$yinhangka = _Account_number::getAccount_numberInfo($wheres);

		include renderTemplate('index/my/account_number');
	}

	if($method == 'apply_fanli')
	{
		unset($wheres);

		$list = _Tongji_log::getUserbrowseListByChanpinID($loginuser['id']);

		if(!empty($loginuser))
		{
			if(empty($loginuser['nickname']))
			{
				header("Location:".SITE_URL.'index.php?a=my');
				exit;
			}
			include renderTemplate('index/my/apply_fanli');
		}


	}

	if($method == 'fanli_record')
	{
		unset($wheres,$sort,$pages,$between);

		$wheres['uid'] = $loginuser['id'];

		//$sort['status'] = 'asc';

		$sort['addtime'] = 'desc';

		$resData = _Fanli::getFanliList($wheres, $page, $between, $sort);


		foreach ($resData  as $key => $value)
		{
			//获取产品信息
			$value['chanpin'] = _ChanPin::getChanPinInfo(array('id'=>$value['pid']));
			//获取获取项目信息
			$value['item'] = _ChanPin::getChanPin_ItemInfo(array('id'=>$value['iid']));

			$list[] = $value;
		}


		include renderTemplate('index/my/fanli');
	}

	if($method == 'tixian_record')
	{
		unset($wheres,$sort,$pages,$between);

		$wheres['uid'] = $loginuser['id'];

		//$sort['status'] = 'asc';

		$sort['addtime'] = 'desc';

		$list = _Tixian::getTixianList($wheres, $pages, $between,$sort);

		include renderTemplate('index/my/tixian');
	}
